import os
import logging
from time import sleep
from selenium import webdriver

driver = webdriver.Chrome()
driver.implicitly_wait(5)

# 获取html绝对路径
file_path = os.path.join('file:///', os.getcwd(), "selenium.html")
logging.info(file_path)

# 打开html文件
driver.get(file_path)

#最大化窗口
driver.maximize_window()

driver.find_element_by_xpath('//*[@id="signup"]/form/input[1]').send_keys('rabbit')
driver.find_element_by_xpath('//*[@id="signup"]/form/input[2]').send_keys('love')
driver.find_element_by_xpath('//*[@id="signup"]/form/input[3]').click()

success = driver.find_element_by_xpath('//*[@id="signup"]/p')
text = success.text
if text == "注册成功":
    print("注册成功")
else:
    print("注册失败")


